home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr13 / tstse13.zip / TEST.S < prev    next >
Text File  |  1994-11-26  |  4KB  |  110 lines

  1. /* A testbench for additional commands for SemWare's TSE editor
  2.    V2.0. To make this SAL macro operational, invoke the main menu
  3.    (F10), choose "Macro", choose "Compile" and press Enter at
  4.    "Execute Macro".
  5.  
  6. ..................................................................
  7. Prof. Timo Salmi      Co-moderator of comp.archives.msdos.announce
  8. Moderating at garbo.uwasa.fi anonymous FTP archives  193.166.120.5
  9. Faculty of Accounting & Industrial Management; University of Vaasa
  10. Internet: ts@uwasa.fi   BBS +(358)-61-3170972; FIN-65101,  Finland
  11. */
  12.  
  13. // The contents of a simple help, tied later to the CtrlAlt-H key
  14. helpdef tHelpData
  15.   title = "TEST.S HELP"           // The help's caption
  16.   x = 10                          // Location
  17.   y = 3
  18.   // The actual help text
  19.   " Prof. Timo Salmi's testbench"
  20.   ""
  21.   " To try out the current tTest() procedure "
  22.   " exit this help and press <CtrlAlt 5>"
  23.   ""
  24.   " You can use <F11> to invoke the command "
  25.   " menu after first exiting this help. "
  26.   ""
  27.   " Last updated Sat 26-November-1994 20:00:15 "
  28. end  /* tHelpData */
  29.  
  30. /* =======================================================================
  31.             Beginning of the procedure(s) to be tested
  32.    ======================================================================= */
  33.  
  34. proc tTest()
  35.     integer mon, day, year, dow,
  36.             hour, min, sec, sec100
  37.     string  month_name[3] = ''
  38.     string  weekday[3] = ''
  39.     string  yearStr[4] = ''
  40.     string  timeStr[8] = ''
  41.     GetDate(mon, day, year, dow)    // get current date
  42.     GetTime(hour, min, sec, sec100)
  43.     case mon
  44.         when  1 month_name = 'Jan'
  45.         when  2 month_name = 'Feb'
  46.         when  3 month_name = 'Mar'
  47.         when  4 month_name = 'Apr'
  48.         when  5 month_name = 'May'
  49.         when  6 month_name = 'Jun'
  50.         when  7 month_name = 'Jul'
  51.         when  8 month_name = 'Aug'
  52.         when  9 month_name = 'Sep'
  53.         when 10 month_name = 'Oct'
  54.         when 11 month_name = 'Nov'
  55.         when 12 month_name = 'Dec'
  56.     endcase
  57.     case dow
  58.       when 1 weekday = 'Sun'
  59.       when 2 weekday = 'Mon'
  60.       when 3 weekday = 'Tue'
  61.       when 4 weekday = 'Wed'
  62.       when 5 weekday = 'Thu'
  63.       when 6 weekday = 'Fri'
  64.       when 7 weekday = 'Sat'
  65.     endcase
  66.     yearStr = Str(year)
  67.     timeStr = Str(hour / 10) + Str(hour mod 10) + ':' + Str(min/10) + Str(min mod 10) + ':' + Str(sec/10) + Str(sec mod 10)
  68.     Message(Format(weekday, ' ', month_name, ' ', day, ' ', timeStr, ' ', year))
  69. end  /* tTest */
  70.  
  71. /* =======================================================================
  72.             End of the procedure(s) to be tested
  73.    ======================================================================= */
  74.  
  75. // New keys and menus **************************************************
  76. forward Menu tTestMenu()
  77. forward proc tDisableNewKeys()
  78.  
  79. // Add the new key definitions
  80. keydef new_keys
  81.   <CtrlAlt 5>      tTest()
  82.   <CtrlAlt 0>      tDisableNewKeys()
  83.   <CtrlAlt H>      QuickHelp(tHelpData)
  84.   <F11>            tTestMenu()
  85. end
  86.  
  87. // Disabling the new extra keys ***************************************
  88. proc tDisableNewKeys()
  89.   if YesNo("Disable the extra keys:") == 1 Disable(new_keys) endif
  90. end
  91.  
  92. // The test menu ******************************************************
  93. Menu tTestMenu()
  94.   Title = "Timo's testbench menu"
  95.   Width = 19
  96.   x = 40
  97.   y = 3
  98.   history
  99.   "&Test              <CtrlAlt 5>"   , tTest()
  100.   "",,Divide
  101.   "Disable &new keys  <CtrlAlt 0>"   , tDisableNewKeys()
  102.   "&Help              <CtrlAlt H>"   , QuickHelp(tHelpData)
  103.   "This Menu         <F11>"
  104. end  /* tTestMenu */
  105.  
  106. proc Main()
  107.   Enable (new_keys)
  108.   tTestMenu()
  109. end
  110.